﻿using AutoMapper;
using Enter.Admin.Dtoes;
using Enter.Admin.Entities;
using Enter.Admin.Models.DataTables;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Enter.Admin.Configs
{
    public class AutoMapperConfigs : Profile
    {
        public AutoMapperConfigs()
        {
            CreateMap<Archive, ArchiveModel>();//.ForAllMembers(opt => opt.DoNotAllowNull())
            CreateMap<ArchiveModel, Archive>();//.ForAllMembers(opt => opt.DoNotAllowNull())

            CreateMap<Archive, CaseIndex1Model>().ReverseMap();
            CreateMap<Archive, CaseIndex2Model>().ReverseMap();
            CreateMap<Archive, CaseIndex3Model>().ReverseMap();

            CreateMap<DataTablesColumn, DataTablesColumn>();
            
            CreateMap<Notice, NoticeModel>();
            CreateMap<NoticeModel, Notice>();

            CreateMap<Archive, ArchiveNaturalModel>();
            CreateMap<Archive, ArchiveNatural>();

            CreateMap<ArchiveNatural, ArchiveNaturalModel>();
            CreateMap<ArchiveNaturalModel, ArchiveNatural>();

            CreateMap<Employ, EmployModel>()
                .ForMember(dest=>dest.RoleName, opt => opt.MapFrom(src => src.Role.RoleName));
        }
    }
}
